<?php

namespace App\Services\Core\Sms;

use App\Helpers\UserAgent;
use App\Models\Factory\SmsFactory;
use App\Models\Orm\MessageLog;
use App\Services\AppService;
use App\Services\Core\Sms\Changzhuo\ChangzhuoService;
use App\Services\Core\Sms\Chuanglan\ChuanglanService;
use App\Services\Core\Sms\Dahan\DahanService;
use App\Services\Core\Sms\Wwtl\WwtlService;
use App\Services\Core\Sms\Yimei\YimeiService;
use Carbon\Carbon;
use DB;
use App\Helpers\Utils;
use Cache;
use App\Helpers\Generator\TokenGenerator;
use Log;

class SmsService extends AppService
{
	public static $services;

	public static function i()
	{

		if (!(self::$services instanceof static))
		{
			self::$services = new static();
		}

		return self::$services;
	}

    /**
     *
     * @param $mobile
     * @return string
     */
	public function to($mobile)
	{

		$config = SmsFactory::getSmsConfig();
		switch ($config)
		{
			case 'chuanglan':
				$re = ChuanglanService::i()->send($mobile);
				break;
			case 'dahan':
				$re = DahanService::i()->send($mobile);
				break;
			default:
				$re = ChuanglanService::i()->send($mobile);
				break;
		}
		return $re;
	}

}